const TOKEN_KEY = 'token';
const USER_ROLE_KEY = 'user_role';

export function getToken() {
    return localStorage.getItem(TOKEN_KEY);
}

export function setToken(token) {
    localStorage.setItem(TOKEN_KEY, token);
}

export function removeToken() {
    localStorage.removeItem(TOKEN_KEY);
}

export function getUserRole() {
    // 在实际应用中，角色信息应该从 token 中解析出来
    // 这里为了简化，我们假设登录时也将角色存入了 localStorage
    return localStorage.getItem(USER_ROLE_KEY) || 'guest';
}

export function setUserRole(role) {
    localStorage.setItem(USER_ROLE_KEY, role);
}

export function removeUserRole() {
    localStorage.removeItem(USER_ROLE_KEY);
}